import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import locale from "element-ui/lib/locale/lang/en";
// 引入element-ui组件
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
Vue.use(ElementUI, { locale });
import "./assets/common.css";
Vue.config.productionTip = false;
(Vue.prototype.$date = function (v) {
  let flag = !Number.isNaN(Number(new Date(v)));
  let date = null;
  if (!flag) {
    // 不是合法的日期
    date = new Date();
  } else {
    date = new Date(v);
  }
  let y = date.getFullYear();
  let mon = (date.getMonth() + 1 + "").padStart(2, "0");
  let d = (date.getDate() + "").padStart(2, "0");
  let h = (date.getHours() + "").padStart(2, "0");
  let m = (date.getMinutes() + "").padStart(2, "0");
  let s = (date.getSeconds() + "").padStart(2, "0");
  return `${y}-${mon}-${d} ${h}:${m}:${s}`;
}),
  new Vue({
    router,
    store,
    render: (h) => h(App),
  }).$mount("#app");
